//1.导入mysql模块
const mysql = require('mysql2');
//2.使用Mysql模块连接数据库
// const db = mysql.createPool({
//     host: '10.20.72.245',
//     user: 'root',
//     password: '123456',
//     database: 'test-g'
// })
const db = mysql.createConnection({  
    host: '10.20.72.245',
    port: '3307',
    user: 'root',
    password: '123456',
    database: 'test-g' 
  });  
   
  db.connect(err => {  
    if(err){
        console.log(err);
        console.log('链接数据库失败');
    }else{
        console.log('链接数据库成功');
    }  
  });

module.exports = db